package com.peaksport.framework.metadata.venum;

import com.peaksport.framework.exception.PKDevException;

/**
 *  SorterItemInfo排序方式
 * 
 * @author jinbin_guo  2019年4月15日 下午4:45:13
 *
 */
public enum SortDirectionEnum {

    DESC("desc"),ASC("asc");

    private String value;
    private SortDirectionEnum(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public static SortDirectionEnum get(String sortDirectionValue) {
        if (sortDirectionValue == null) return null;
        else if ("desc".equalsIgnoreCase(sortDirectionValue))  return DESC;
        else if ("asc".equalsIgnoreCase(sortDirectionValue)) return ASC;
        else throw PKDevException.throwException("暂未支持的排序方向的枚举值[%s],请联系统管理人员.", sortDirectionValue);
    }

    @Override
    public String toString() {
        return value;
    }
}
